import ajax from '@/utils/request'
import { concatUrl } from '@/utils'

// 获取团长状态
export function getLeaderStatus(data = {}) {
  return ajax({
    url: concatUrl('/v1/distribution/distribution-leader/get-leader-status'),
    data,
    method: 'GET'
  })
}

// 申请成为团长
export function applyLeader(data = {}) {
  return ajax({
    url: concatUrl('/v1/distribution/distribution-leader/add-distribution-leader'),
    data,
    method: 'GET'
  })
}

// 团长详情
export function getLeaderDetails(data = {}) {
  return ajax({
    url: concatUrl('/v1/distribution/distribution-leader/get-leader-info'),
    data,
    method: 'GET'
  })
}


// 添加我的客户
export function addCustomer(data, fields: string | object = { fields: 'id,customerUserId,carLicense,distributionId' }) {
  return ajax({
    url: concatUrl(`/v1/distribution/distribution-leader/add-customer-car`, fields),
    data,
    method: 'GET'
  })
}

// 我的客户列表
export function getCustomerList(data = {}) {
  return ajax({
    url: concatUrl('/v1/distribution/distribution-leader/get-customer-car'),
    data,
    method: 'GET'
  })
}


// 获取分享码
export function getDistributionQrCode(data = {}) {
  return ajax({
    url: concatUrl('/v1/distribution/distribution-leader/get-qr-code'),
    data,
    method: 'GET'
  })
}

// 年卡分销获取分享码
export function getMiniShareImage(data = {}) {
  return ajax({
    url: concatUrl('/v1/activity/share-activity/get-mini-share-image'),
    data,
    method: 'GET'
  })
}

// B端分销获取分享码
export function getRetailQrCode(data = {}) {
  return ajax({
    url: concatUrl('/v1/sDistribution/distribution-user/get-share-qrcode'),
    data,
    method: 'GET'
  })
}

// 司庆领取红包
export function receiveRedPacket(data) {
  return ajax({
    url: concatUrl('/v1/activity/company-birthday/receive-red-packet'),
    data,
    method: 'POST'
  })
}


// 可获取的红包金额
export function getReceiveAmount() {
  return ajax({
    url: concatUrl('/v1/activity/company-birthday/get-can-receive-red-packet-amount'),
    method: 'GET'
  })
}


// 集划算-分享日志记录
export function updateShareLog(data) {
  return ajax({
    url: concatUrl('/v1/jihuasuan/jihuasuan/share-log'),
    data,
    method: 'POST'
  })
}

// 集划算-浏览日志记录
export function updateViewLog(data) {
  return ajax({
    url: concatUrl('/v1/jihuasuan/jihuasuan/view-log'),
    data,
    method: 'POST'
  })
}


// 集划算-商品详情
export function getJihuasuanGoodsView(data, fields: string | object = { fields: 'isDeleted,id,detailUploadUrl' }) {
  return ajax({
    url: concatUrl(`/v1/jihuasuan/jihuasuan-goods/view`, fields),
    data,
    method: 'GET'
  })
}

// 集划算-活动详情
export function getJihuasuanView(data, fields: string | object = { fields: 'goods.isDeleted,mostReward,activityStatus,orderRecords,goods.referUploadUrl,upload1Url,upload2Url,upload3Url,upload4Url,upload5Url,upload6Url,upload7Url,price,goods.annualCardItems,goods.platformPrice,goods.price,activityInfo.viewTimes,activityInfo.orderTimes,activityInfo.shareTimes,id,createdAt,updatedAt,title,keyword,wechatMiniUrl,blackBoxUrl,status,startAt,endAt,isLongTime,level,serviceChargeType,serviceCharge,index,uploadId1,uploadId2,uploadId3,uploadId4,shareBodyTitle,uploadId5,shareHeaderTitle,uploadId6,uploadId7,goods.id,goods.type,goods.referId,goods.referName,goods.pRewardType,goods.pReward,goods.ppRewardType,goods.ppReward,goods.serviceCharge,goods.referUploadId,goods.index' }) {
  return ajax({
    url: concatUrl(`/v1/jihuasuan/jihuasuan/view`, fields),
    data,
    method: 'GET'
  })
}

// 除夕领取红包
export function newYearReceiveRedPacket(data) {
  return ajax({
    url: concatUrl('/v1/activity/red-packet-activity/receive-red-packet'),
    data,
    method: 'POST'
  })
}


// 除夕可获取的红包金额
export function getNewYearReceiveAmount() {
  return ajax({
    url: concatUrl('/v1/activity/red-packet-activity/get-can-receive-red-packet-amount'),
    method: 'GET'
  })
}
